package com.xuzy.x808.common.enums;


import lombok.Getter;

/**
 * 服务端消息类型，key是消息名称，value是消息Id
 */
@Getter
public enum MsgTypeEnum {

    CLIENT_REGISTER("clientRegisterProcessor", 0x0100),
    CLIENT_LOGOUT("clientLogoutProcessor", 0x0003),
    HEART_BEAT("heartBeatProcessor", 0x0002),
    CLIENT_AUTHENTICATION("clientAuthenticationProcessor", 0x0102),
    LOCATION_REPORT("locationReportProcessor", 0x0200),

    CLIENT_REGISTER_RESP("clientRegisterResp", 0x8100),
    NORMAL_RESP("ServerNormalResp", 0x8001);

    private String name;
    private int msgId;

    MsgTypeEnum(String name, int msgId) {
        this.name = name;
        this.msgId = msgId;
    }

    public static int getMsgIdByName(String name) {
        for (MsgTypeEnum value : MsgTypeEnum.values()) {
            if (name.equals(value.name)) {
                return value.msgId;
            }
        }
        return 0;
    }

}
